package com.health.patient.server.mapper;

import com.health.health.common.dto.PmsPatientGroupDto;
import com.health.health.common.dto.PmsPatientRecordDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PatientMapper {

    /**
     * 获取患者分组列表
     * @return
     * ybz
     */
    List<PmsPatientGroupDto> getPatientGroupList(Long doctorId);

    /**
     * 判断是否已经添加过此名称
     *
     * @param groupName
     * @param doctorId
     * @return
     * ybz
     */
    Integer isAddedByGroupName(@Param("groupName") String groupName,@Param("doctorId") Long doctorId);

    /**
     * 添加患者分组
     * @param groupName
     * @param doctorId
     * @return
     * ybz
     */
    boolean addPatientGroup(String groupName, Long doctorId);

    /**
     * 删除患者分组
     * @param groupId
     * @return
     * ybz
     */
    Integer deletePatientGroup(@Param("groupId") Long groupId,@Param("doctorId") Long doctorId);

    /**
     * 根据分组ID获取患者列表
     *
     * @param groupId
     * @param doctorId
     * @return ybz
     */
    List<PmsPatientRecordDto> getPatientListByGroupId(@Param("groupId") Long groupId,@Param("doctorId") Long doctorId);

    /**
     * 根据患者ID和医生ID获取患者所在分组列表
     * @param patientRecordId
     * @param doctorId
     * @return
     * ybz
     */
    List<PmsPatientGroupDto> getPatientGroupListByPatientId(@Param("patientRecordId") Long patientRecordId,@Param("doctorId") Long doctorId);

    /**
     * 根据患者ID和医生ID删除患者所在分组
     * @param patientRecordId
     * @param doctorId
     * ybz
     */
    void deletePatientGroupByPatientId(Long patientRecordId, Long doctorId);

    /**
     * 添加患者和分组
     * @param doctorId
     * @param patientRecordId
     * @param groupIdArray
     * ybz
     */
    int addPatientAndGroup(@Param("doctor") Long doctorId,@Param("patientRecordId") Long patientRecordId,@Param("groupIdArray") String[] groupIdArray,@Param("groupNameArray") String[] groupNameArray);

    String getGroupName(@Param("doctorId") Long doctorId ,@Param("groupId") String groupId);

    /**
     * 删除分组和患者
     * @param groupId
     * @param doctorId
     * @return
     */
    Integer deleteGroupAndPatient(@Param("groupId") String groupId,@Param("doctorId") Long doctorId );

    void addPatientRecord(PmsPatientRecordDto patientRecordDto);
}
